<?php

namespace app\astroapp\controller\v1;

use app\astroapp\controller\AstroAppRemoteAuth;

class AstroCard extends AstroAppRemoteAuth
{
    /**
     * 获取 星座卡片 - 四象卡
     * @return \think\response\Json
     */
    public function getElementData()
    {
        $recodeInfo = input('recode/s', '');
        $recodeInfo = $recodeInfo ? json_decode($recodeInfo, true) : [];
        if (!$recodeInfo)
        {
            return show(config('code.error'), '请求参数错误');
        }
        $resData = (new \app\web\service\AstroCard())->getElementData($recodeInfo);

        return show(config('code.success'), '请求成功', $resData);
    }

    /**
     * 获取 星座卡片 - 使用说明书
     * @return \think\response\Json
     */
    public function getInstructionData()
    {
        $recodeInfo = input('recode/s', '');
        $recodeInfo = $recodeInfo ? json_decode($recodeInfo, true) : [];
        if (!$recodeInfo)
        {
            return show(config('code.error'), '请求参数错误');
        }
        $resData = (new \app\web\service\AstroCard())->getInstructionData($recodeInfo);

        return show(config('code.success'), '请求成功', $resData);
    }
}